import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/home.vue'
import Login from "../views/login/login.vue"
import Categories from "../views/categories/categories.vue"
import Goods from "../views/goods/goods.vue"
import Orders from "../views/orders/orders.vue"
import Params from "../views/params/params.vue"
import Reports from "../views/reports/reports.vue"
import Rights from "../views/rights/rights.vue"
import Roles from "../views/roles/roles.vue"
import Users from "../views/users/users.vue"
import Welcome from "../views/welcome/welcome.vue"
import Add from "../views/goods/add/add.vue"

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/login"
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/welcome',
    children: [
      {
        path: '/categories',
        component: Categories
      },
      {
        path: '/goods',
        component: Goods,
        children: [
          {
            path: '/goods/add',
            component: Add,
          }
        ]
      },
      {
        path: '/orders',
        component: Orders
      },
      {
        path: '/params',
        component: Params
      },
      {
        path: '/reports',
        component: Reports
      },
      {
        path: '/rights',
        component: Rights
      },
      {
        path: '/roles',
        component: Roles
      },
      {
        path: '/users',
        component: Users
      },
      {
        path: '/welcome',
        component: Welcome
      },
      // {
      //   path: '/goods/add',
      //   component: Add,
      // }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
 
]

const router = new VueRouter({
  routes
})

export default router
